<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta charset="utf-8">
    <title>{$partner.name} 后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!--[if lt IE 10]>
      <style type="text/css">.isIE{display:block !important;}</style>
    <![endif] -->
    <!--<link rel="stylesheet" href="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/css/bootstrap.min.css">-->
    <link rel="stylesheet" type="text/css" href="http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.min.css"/>
    <style type="text/css">
      body {
        font-family: "Microsoft YaHei" !important;
        padding-top: 50px;
      }
  
      ul, ol {
        list-style: none;
      }
  
      ul, li, dl {
        margin: 0;
        padding: 0;
      }
  
      .navbar-brand {
        padding-top: 10px;
        padding-bottom: 0;
        padding-left: 0;
        height: 50px;
        overflow: hidden;
      }
  
      .wmfl-main {
        position: absolute;
        left: 200px;
        right: 15px;
        top: 20px;
        bottom: 20px;
      }
  
      #main {
        position: absolute;
        width: 100%;
        height: 100%;
        border: none;
      }
  
      .wmfl-navbar {
        width: 200px;
        height: 100%;
        background: #eee;
        border-radius: 5px;
        position: fixed;
      }
  
      .wmfl-navbar li a {
        display: block;
        line-height: 40px;
        padding-left: 20px;
      }
  
      .wmfl-navbar li a:hover, .wmfl-navbar li.active a {
        background: #cecece;
        text-decoration: none;
      }
  
      footer.wmfl-copr {
        position: absolute;
        bottom: 0;
        left: 50%;
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%);
      }
  
      .container {
        width: 100%;
      }
  
      .isIE {
        position: fixed;
        z-index: 9998;
        left: 35%;
        top: 50px;
        display: none;
      }
  
      .wmfl-nav {
        border-top: 3px solid #B84D88;
      }
  
      .wmfl-container {
        position: fixed;
        height: 100%;
      }
  
      .priview-btn {
        position: fixed;
        right: 0;
        top: 45%;
      }
      .open-btn {
        position: fixed;
        right: 0;
        top: 55%;
      }
  
      .open-btn a {
        display: block;
        text-decoration: none;
        color: #fff;
      }
  
      .wmfl-phone-priview {
        position: absolute;
        right: 100px;
        top: 70px;
        width: 320px;
        height: 668px;
        display: none;
      }
    </style>
  </head>
  <body>
    <!-- 顶部导航  -->
    <nav class="nav-bar navbar-inverse navbar-fixed-top wmfl-nav" role="navigation">
      <div class="container">
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#wmfl-nav">
          <span class="sr-only">Toggle navigation</span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
        <a href="javascript:void(0)" class="navbar-brand"><img alt="{$partner.name}" id="wmfl-logo" style="max-height:32px;" src="http://7sbrxx.com2.z0.glb.qiniucdn.com/zhuoyan/zhuoyan-logo.jpg"></a>
      </div>
      <div class="collapse navbar-collapse">
        <ul class="nav navbar-nav" id="top-menu">
          <volist name="topMenu" id="vo">
          <li><a href="#" id="{$vo.id}" data-url="{$vo.url}">{$vo.name}</a></li>
          </volist>
        </ul>
        <!-- 管理员 -->
        <ul class="nav navbar-nav navbar-right">
          <li><a href="javascript:void(0)" id="copy-home-url" data-url="{$siteUrl}">首页地址</a></li>
          <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">{$Think.session.name} <b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><a href="__MODULE__/Information" target="main">信息修改</a></li>
              <li class="divider"></li>
              <li><a href="__MODULE__/login/logout/p/{$partner.label}/pid/{$partner.id}">退出</a></li>
            </ul>
          </li>
        </ul>
      </div>
      </div>
    </nav>
    <!-- 中央内容 -->
    <section class="container wmfl-container">
      <!-- 左侧导航 -->﻿
      <nav class="wmfl-navbar" id="wmfl-navbar">
        <ul>
          <volist name="shortcutMenu" id="vo">
          <li><a href="__MODULE__/{$vo.url}" target="main">{$vo.name}</a></li>
          </volist>
        </ul>
      </nav><!--  -->
      <section class="wmfl-main clearfix">
        <iframe src="__CONTROLLER__/home" id="main" name="main" frameborder="0"></iframe>
      </section>
    </section>
    <footer class="wmfl-copr clearfix">
      <p class="text-center text-muted">©2014 {$partner.name} All Rights Reserved</p>
    </footer>
    <!-- IE10以下浏览器的提示 -->
    <div class="alert alert-danger alert-dismissable isIE">您的浏览器版本过低，风铃建议您换用<a href="#">高级浏览器</a>获得更好的体验效果<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button></div>
    <!-- 手机预览 -->
    <span class="btn btn-info priview-btn" id="priview-btn">预览</span>
    <!-- 手机预览 -->
    <span class="btn btn-info open-btn" id="open-btn"><a href="{$siteUrl}" target="_blank">打开</a></span>
    <div id="priview" class="wmfl-phone-priview"></div>
    <script src="http://cdn.bootcss.com/jquery/1.10.2/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/Style/Common/js/storage.js"></script>
    <script src="__PUBLIC__/Style/Common/js/ZeroClipboard.js"></script>
    <script type="text/javascript">
      
      var previewUrl = "{$siteUrl}";
      //防止iframe嵌套
      $(function(){
        ( window == top ) || ( top.location.href = location.href );
      });
      
      //ajax 获取菜单
      $(function(){
  
        $("#top-menu a").click(function(){
    
          //活动状态
          $(this).addClass("active");
          $(this).parent().siblings().find("a").removeClass("active");
          
          //菜单添加
          var ul = $("#wmfl-navbar ul");
          ul.html("");
          
          //预览地址改变
          previewUrl = "__APP__/Home/" + $(this).attr("data-url") + "?sid={$sid}";
          $("#open-btn a").attr('href', previewUrl);
          
          //ajax loading
          var oLoading = $("<li><span class='get-menu-loading center-block'><img src='__PUBLIC__/Style/My/Default/images/loading.gif'/>加载中</span></li>").appendTo(ul);
          
          $.post("__CONTROLLER__/getSubMenu", { pid: this.id }, function( data ) {
          if ( data !== null ) {
            var list = "";
            for ( var i = 0, menu = null; menu = data[i]; i++ ) {
            list += "<li><a href='__MODULE__/" + menu.url + "' target='main'>" + menu.name + "</a></li>";
            };
            ul.html( list );
          } else {
            ul.html( "" );
          }
          });
          return false;
        });
        });
        
        //左侧子菜单添加活动状态
        $(function(){
          $("#wmfl-navbar ul").delegate("li", "click", function(){
            $(this).siblings("li").removeClass("active");
            $(this).addClass("active");
          });
        });
        
        // //本地存储图片
        // $(function(){
        //   var wmflLogo = document.getElementById("wmfl-logo");
        //   new storageImage(wmflLogo, "wmflLogo", 7);
        // });
        
        //手机预览 iframe页面中需添加一个id为preview-url的元素，该元素属性data-url既为要预览地址，否则则默认预览首页
        $(function(){
        
          var btn = $("#priview-btn");
          btn.status = "close";
          
          btn.click(function(){
            url = $("#main").contents().find("#preview-url").attr("data-url") || previewUrl;
            if ( btn.status == "close" ) {
              btn.html("关闭");
              btn.status = "open";
              $("#priview").mobilePreview(url);
            } else if ( btn.status == "open" ) {
              btn.html("预览");
              btn.status = "close";
              $("#priview").hide();
            };
          });
          
        });
        
        $(function(){
          $().copyPaste({
            text: $("#copy-home-url").attr("data-url"),
            id: $("#copy-home-url").attr("id")
          });
        });
    </script>
    <script type="text/javascript">
      (function($){
        $.fn.extend({
          mobilePreview: function(url){
          var configs = {
            topHeight: 50,
            bottomHeight: 68,
            bodyHeight: 560,
            bodyWidth: 315,
            radius: 39,
            border: 15
          };
          $(this).html("").show();
          
          //手机预览顶部
          $("<div></div>").appendTo(this).css({
            width: configs.bodyWidth + configs.border * 2,
            height: configs.topHeight,
            backgroundColor: '#242021',
            borderRadius: configs.radius + 'px ' + configs.radius + 'px 0 0'
          });
          
          //手机预览中心
          this.content = $('<div></div>').appendTo(this).css({
            boxSizing: "content-box",
            width: configs.bodyWidth,
            height: configs.bodyHeight,
            backgroundColor: "#ffffff",
            borderLeft: configs.border + "px solid #242021",
            borderRight: configs.border + "px solid #242021",
            borderTop: "none",
            borderBottom: "none"
          });
          
          this.container = $("<iframe src='' id='iframe-preview'></iframe>").appendTo(this.content).css({
            width: "100%",
            height: "100%",
            border: "none"
          });
          
          //手机预览底部
          this.footer = $("<div></div>").appendTo(this).css({
            width: configs.bodyWidth + configs.border * 2,
            height: configs.bottomHeight,
            lineHeight: configs.bottomHeight,
            background: "#242021 url(__PUBLIC__/Style/My/Default/images/reload.png) center center no-repeat",
            color: "#fff",
            textAlign: "center",
            borderRadius: '0 0 ' + configs.radius + 'px ' + configs.radius + 'px'
          });
          
          // 手机预览底部添加内容
          this.footer.html('');
          
          this.container.attr('src', url);
            var _this = this;
            this.footer.click(function(){
              _this.container.attr('src', url);
            });
          },
          //消息通知(固定在浏览器顶部的居中文本)， type类型有: success/info/warning/danger（默认info）， msg: 弹出消息（默认无）
          alertMsg: function( configs ) {
            var defaults = {
              type: "info",
              msg: ""
            };
            configs = $.extend({}, defaults, configs);
            var oMsg = $("<div class='alert alert-" + configs.type + " alert-dismissable'>" + configs.msg + "<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;</button>" + "</div>").appendTo(document.body);
            oMsg.css({
              position: "fixed",
              zIndex: "9999",
              top: "50px",
              maxWidth: "500px",
              overflow: "hidden",
              left: "50%",
              WebkitTransform: "translateX(-50%)",
              display: "none",
              borderRadius: "0 0 4px 4px"
            });
            oMsg.slideDown(600).delay(2000).slideUp(600, function(){
              oMsg.remove();
            });
          }
        });
        
        $.fn.extend({
          copyPaste: function(configs){
            var clip = new ZeroClipboard.Client();
            ZeroClipboard.setMoviePath("/Public/Style/Common/js/ZeroClipboard.swf");
            clip.setText(configs.text);
            clip.glue(configs.id);
            clip.addEventListener("onComplete", function(){
              $().alertMsg({ "type": "success", "msg": "复制成功，使用 ctrl+v 复制到别处吧！" });
            });
          }
        });
      })(jQuery)
    </script>
  </body>
</html>
